<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Foo(a) {
            this.count = a;
            this.getC = function() {
                return a
            }
        }
        const foo1 = new Foo(1);
        const foo2 = new Foo(2);
        console.log(foo1.getC())
        foo1.getC = foo2.getC;
        console.log(foo1.getC())
    </script>
</body>

</html>